<?php
namespace app\admin\validate;
use think\Validate;

/**
 * Created by PhpStorm.
 * User: HuangLuSen
 * Date: 2017/5/4
 * Time: 19:36
 */
class Group extends Validate
{
    protected $rule = [
        'title'     =>  'require|token',
        'address'   =>  'require',
        'tel'       =>  'require|unique:group',
        'depar_id'  =>  'require',
        'dq_id'  =>  'require',
    ];
    protected $message =[
        'title.require'=>'门店名称不能为空',
        'address.require'=>'门店地址不能为空',
        'tel.require'=>'门店电话必填',
        'tel.unique'=>'电话重复了',
        'depar_id.require'=>'部门必选',
        'dq_id.require'=>'地区必选',
    ];
    protected $scene = [
        'edit'  =>  [
            'tel'=>'require|unique:group,tel^id','dq_id','depar_id','tel','address'
        ]
    ];
}